package com.example.combwyaq.mvp.model;

import android.util.Log;

import com.blankj.utilcode.util.LogUtils;
import com.example.combwyaq.db.DaoManager;
import com.example.combwyaq.entity.ResponseUserEntity;
import com.example.combwyaq.entity.UserEntity;
import com.example.combwyaq.http.Api;
import com.example.combwyaq.http.HttpFactory;
import com.example.combwyaq.http.HttpType;
import com.example.combwyaq.mvp.ChangeFuncation;
import com.example.combwyaq.mvp.contract.PersonalDetailsConteract;
import com.example.combwyaq.mvp.model.entity.BaseEntity;
import com.example.combwyaq.mvp.model.entity.UpLoadEntity;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;
import okhttp3.RequestBody;

public class PersonalDetailsModel extends BaseModel implements PersonalDetailsConteract.IPersonalModel {

    @Inject
    public PersonalDetailsModel() {
    }

    @Override
    public Observable<BaseEntity> request(Map<String, Object> map) {
        RequestBody body = createBody(map);
        Observable<UpLoadEntity> ob = HttpFactory.getInstance().factory(HttpType.TOKENSIGNTYPE)
                .getRetrofit()
                .create(Api.class)
                .requestUpdateUser(body);
        LogUtils.json(map);
        return ob.map(new ChangeFuncation<UpLoadEntity>());
    }


}
